package cn.aifeix.feign;

import cn.aifeix.domain.User;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * UserFeignClient的托底工厂类实现
 */
@Component
public class UserFeignClientFallbackFactory implements FallbackFactory<UserFeignClient> {
    @Override
    public UserFeignClient create(Throwable throwable) {
        throwable.printStackTrace();
        return new UserFeignClient() {
            @Override
            public User getUserById(Long id) {
                return new User(-1L,"熔断了","触发熔断了");
            }
        };
    }
}
